package com.graduate.game.user.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.graduate.game.user.mapper.UserMapper;
import com.graduate.game.user.pojo.User;
import com.graduate.game.user.pojo.userdata;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class UserdataServiceImpl implements UserdataService {
    @Resource
    private UserMapper userMapper;
    @Override
    public userdata getOneUserdata(String username) {
        return userMapper.queryUserdataList(username);
    }

    @Override
    public List<userdata> goldRank() {
        return userMapper.goldRank();
    }

    @Override
    public List<userdata> experienceRank() {
        return userMapper.experienceRank();
    }


    @Override
    public List<userdata> findAllUserByPageS(Map<String,Object> data) {
        List<userdata> goldrankbypage = userMapper.goldrankbypage(data);
        return goldrankbypage;

    }

    @Override
    public List<userdata> experienceRankByPageS(Map<String, Object> data) {
        List<userdata> goldrankbypage = userMapper.experienceRankbypage(data);
        return goldrankbypage;
    }

    @Override
    public boolean updateGoldRank(userdata userdate) {
        int i = userMapper.updateGold(userdate);
        if(i>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateEx(userdata userdate) {
        int i = userMapper.updateEx(userdate);
        if(i>0){
            return true;
        }else {
            return false;
        }
    }


}
